<template>
    <div>
        <input type="text" v-model="title" placeholder="请输入" @keydown.enter="add">
    </div>
</template>

<script setup>
import { ref, defineEmits } from 'vue'

const title = ref('')
const emit = defineEmits(['add'])
const add = () => {
    if (!title.value) {
        return alert('不能为空')
    }
    const obj = { title: title.value, ff: false, is: false }
    emit('add', obj)
    title.value=''
}


</script>

<style lang="scss" scoped>
input {
    margin-top: 50px;
    text-align: center;
}
</style>